<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>展示知识点</title>
    <meta name="description" content="${constants.getSystemName()}">
    <meta name="author" content="stylefeng">

    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
</head>

<body>
<div style="text-align: center; margin-top: 20px">
    <div id="test4" class="demo-transfer"></div>
    <div class="layui-btn-container">
        <button type="button" class="layui-btn dianwo" lay-demotransferactive="getData">确定</button>
    </div>
</div>
@/* 加入contextPath属性和session超时的配置 */
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>
<script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>

<script type="text/javascript">
    layui.use(['table', 'admin', 'ax', 'func','transfer', 'layer', 'util'], function(){
        var $ = layui.$
            ,transfer = layui.transfer
            ,layer = layui.layer
            ,util = layui.util;
        var table = layui.table;
        var $ax = layui.ax;
        var admin = layui.admin;
        var func = layui.func;
        var chapters = "";

        getKnowledge();

        //获取知识点内容
        function getKnowledge(){
            var ajax = new $ax(Feng.ctxPath + "/knowledgeContent/getKnowledgeList?stageId=${stageId}");
            var result = ajax.start();
            chapters = result.data.chapters;
            //显示搜索框
            transfer.render({
                elem: '#test4'
                ,data: result.data.knowledgeContents
                ,title: [result.data.chapters, '选中内容']
                ,showSearch: true
                ,id: 'trans'
            })
        }

        //批量办法定事件
        util.event('lay-demoTransferActive', {
            getData: function(othis){
                var getData = transfer.getData('trans'); //获取右侧数据
                if(getData.length==0){
                    layer.msg("请选择知识点");
                    return false;
                }
                if(getData.length >1){
                    layer.msg("只能勾选一个知识点");
                    return false;
                }
                $(window.parent.document).find("#knowledgeContentIds").val(getData[0].value);
                $(window.parent.document).find("#knowledgeContentNames").val(getData[0].title);
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            }
        });
    });
</script>
</body>
</html>
